package cn.myjerry.others.pro;

import java.io.IOException;
import java.util.Properties;

/**
 * 使用类相对路径读取配置文件
 * bin
 * @author Jerry
 *
 */

public class Demo03 {
	public static void main(String[] args) throws IOException {
		Properties pro = new Properties();
		//类相对路径	/ => bin
		//pro.load(Demo03.class.getResourceAsStream("/cn/myjerry/others/pro/db.properties"));
		//"" => bin
		pro.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("cn/myjerry/others/pro/db.properties"));
		System.out.println(pro.getProperty("user"));
	}
}
